﻿<KCtl:BaseUserControl xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  x:Class="Kiva7.Pages.TeamsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:KCtl="clr-namespace:Kiva7.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    KCtl:TiltEffect.IsTiltEnabled="True">

    <ListBox x:Name="lbxTeams" Margin="6,0,-12,0" ItemsSource="{Binding Data}" 
              Background="{StaticResource KivaBackgroundBrush}"
             HorizontalContentAlignment="Stretch" SelectionChanged="LbxTeamsSelectionChanged">

        <ListBox.ItemTemplate>

            <DataTemplate>

                <StackPanel Orientation="Horizontal" Margin="0,0,0,18" >
                    <StackPanel Style="{StaticResource KivaListItemImageStyle}">
                        <KCtl:KivaImageControl x:Name="imgLender" ImageSize="Normal"  ImageData="{Binding Image}" 
                            Width="180" Height="180" Margin="0,12,0,0"
                            Visibility="{Binding Image, Converter={StaticResource objectVisibility}}" VerticalAlignment="Top" />
                    </StackPanel>
                    <KCtl:OrientedStackPanel Orientation="Vertical" 
                                             WidthP="260" WidthL="420"
                                             Style="{StaticResource KivaListItemStyle}" Margin="6,0,0,0">

                        <TextBlock Text="{Binding Name}" TextWrapping="Wrap" 
                               Style="{StaticResource KivaTextGroupHeaderStyle}"/>

                        <TextBlock Text="{Binding LoanBecause}" TextWrapping="Wrap" 
                               Style="{StaticResource KivaTextNormalStyle}"/>

                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding MemberCount}" Margin="12,0,0,0" 
                                    Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding Path=L.Members, Source={StaticResource L}}" Margin="12,0,0,0" 
                                    Style="{StaticResource KivaTextAccentStyle}"/>
                        </StackPanel>
                        <toolkit:WrapPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding LoanedAmount, Converter={StaticResource toAmount}}" Margin="12,0,0,0"  
                                    Style="{StaticResource KivaTextAccentStyle}"/>

                            <TextBlock Text="{Binding Path=L.In, Source={StaticResource L}}" 
                                    Style="{StaticResource KivaTextAccentStyle}"/>

                            <TextBlock Text="{Binding LoanCount}"  Margin="12,0,0,0"  
                                    Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding Path=L.Loans, Source={StaticResource L}}"  
                                    Style="{StaticResource KivaTextAccentStyle}"/>

                        </toolkit:WrapPanel>
                    </KCtl:OrientedStackPanel>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

</KCtl:BaseUserControl>
